<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>壹码当先 - 新闻资讯</title>
    <link href="/pages/css/kefu.css" rel="stylesheet">
    <script type="text/javascript" src="/pages/js/jquery001.js"></script>
    <script type="text/javascript" src="/pages/js/jquery.min.js"></script>
    <!-- Chosen CSS -->
    <link href="/pages/css/login-register.css" rel="stylesheet">
    <!-- Pretty Photo CSS -->
    <link href="/pages/css/prettyPhoto.css" rel="stylesheet">

    <!-- Swiper Slider CSS -->
    <link href="/pages/css/flexslider.css" rel="stylesheet">
    <!-- Custom Main StyleSheet CSS -->
    <link href="/pages/style.css" rel="stylesheet">
    <!-- Color CSS -->
    <link href="/pages/css/color.css" rel="stylesheet">
    <link href="/pages/css/color-2.css" rel="stylesheet">
    <!-- Responsive CSS -->
    <link href="/pages/css/responsive.css" rel="stylesheet">

    <script type="text/javascript">
        $(function () {

            /**
             * 页面加载新闻标签
             */
            $.post("/label/all", {}, function (result) {
                if (result.status === 1) {
                    var labels = result.data;
                    var html = '';
                    for (var i = 0; i < labels.length; i++) {
                        html += '<li><a href="javascript:void(0);" onclick="loadNews(' + labels[i].name + ')">' + labels[i].name + '</a></li>'
                    }
                    $("#labels").html(html);
                }
            })

            loadNews(localStorage['labelName']);

        })

        /**
         * 加载新闻列表
         */
        function loadNews(label) {
            //清空本地缓存
            localStorage['labelName'] = '';
            //需要写分页
            $.post("/news/page", {label: label}, function (result) {
                if ((!result.hasOwnProperty('status'))) {
                    if (result.result.length > 0) {
                        var news = result.result;
                        var html = '';
                        for (var i = 0; i < news.length; i++) {
                            html += '<div class="gt_event_grid gt_event_list default_width mb30">' +
                                    '<figure>' +
                                    '<img src="/pages/extra-images/event-list-01.jpg" alt="">' +
                                    '<figcaption class="gt_event_grid_date">' +
                                    '01<span>july</span>' +
                                    '</figcaption>' +
                                    '</figure>' +
                                    '<div class="gt_event_grid_des default_width">' +
                                    '<h6>' + news[i].title + '</h6>' +
                                    '<ul class="gt_event_meta">' +
                                    '<li><i class="fa fa-map-marker"></i>' + news[i].label + '</li>' +
                                    '<li><i class="fa fa-map-marker"></i>' + news[i].publishTime + '</li>' +
                                    '</ul>' +
                                    '<p>' + news[i].introduction + '</p>' +
                                    '<a href="javascript:void(0);" onclick="detail(' + news[i].id + ')">详情</a>' +
                                    '</div>' +
                                    '</div>';
                        }
                        $("#news").html(html);
                    }
                }
            })
        }
        //查看新闻详情
        function detail(newsid) {
            localStorage['newsid'] = newsid;
            window.location.href = "/pages/ymdx/news/news_details.html";
        }
    </script>

</head>

<body onload="IFrameResize()">

<script type="text/javascript">
    function IFrameResize() {
        //alert(this.document.body.scrollHeight); //弹出当前页面的高度
        var obj = parent.document.getElementById("iframe1");  //取得父页面IFrame对象
        //alert(obj.height); //弹出父页面中IFrame中设置的高度
        obj.height = this.document.body.scrollHeight;  //调整父页面中IFrame的高度为此页面的高度
    }
</script>

<!--Sub Banner Wrap Start -->
<div class="gt_sub_banner_bg default_width">
    <div class="container">
        <div class="gt_sub_banner_hdg  default_width">
            <h2>新闻资讯</h2>
            <h6>壹码当先&nbsp;·&nbsp;让更多的孩子爱上编程</h6>
        </div>
    </div>
</div>
<!--Sub Banner Wrap End -->
<!--Breadcrumb Wrap End -->
<div class="gt_breadcrumb_bg default_width">
    <div class="container">
        <div class="gt_breadcrumb_wrap default_width">
            <ul>
                <li><a href="/pages/index.html">首页</a></li>
                <li><a href="/pages/ymdx/news/news.html">新闻资讯</a></li>
            </ul>
        </div>
    </div>
</div>
<!--Breadcrumb Wrap End -->

<!--Main Content Wrap Start-->
<div class="gt_content_wrap">
    <!--Event List Wrap Start-->
    <section class="gt_courses_bg">
        <div class="container">
            <div class="row">
                <!--List Wrap Start-->
                <div class="col-md-8" id="news">

                </div>
                <!--List Wrap Start-->
                <!--Aside Wrap End-->
                <aside class="col-md-4">
                    <div class="gt_resp_margn default_width">
                        <!--Aside Categories Wrap Start-->
                        <div class="gt_aside_category gt_aside2_hdg mb30">
                            <h5>分类</h5>
                            <ul id="labels">

                            </ul>
                        </div>
                        <!--Aside Categories Wrap End-->
                    </div>
                </aside>
                <!--Aside Wrap Start-->
            </div>

            <!--Pagination Wrap Start-->
            <div class="gt_pagination_outer_wrap" style="margin-top: 20px;">
                <ul>
                    <li><a href="#"><i class="fa fa-angle-double-left"></i></a></li>
                    <li class="active"><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#"><i class="fa fa-angle-double-right"></i></a></li>
                </ul>
            </div>
            <!--Pagination Wrap End-->

        </div>
    </section>
    <!--Event List Wrap End-->
</div>
<!--Main Content Wrap End-->


<!--Back to Top Wrap Start-->
<!--     <div class="back-to-top">
        <a href="#home"><i class="fa fa-angle-up"></i></a>
    </div> -->
<!--Back to Top Wrap Start-->


<!--Jquery Library-->
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<!--Bootstrap core JavaScript-->
<script src="http://www.jq22.com/jquery/bootstrap-3.3.4.js"></script>
<!--Time Counter Javascript-->
<script src="/pages/js/jquery.downCount.js"></script>
<!--Custom JavaScript-->
<script src="/pages/js/custom.js"></script>

</body>
</html>
